<template>
    <div>
        <strong style="font-size: large">共{{list.length}}篇</strong>
        <a-list style="margin-top: 10px">
            <a-list-item v-for="i in list" :key="i.content.id">
                <a-list-item-meta>
                    <a slot="title" style="font-weight: bold" target="_blank" :href="'https://jxjlife.cn/article/'+i.content.id">{{i.content.title}}</a>
                </a-list-item-meta>
                {{i.user.name}}
                <a-divider type="vertical"/>
                {{i.content.theTime}}
                <span style="float: right">
                    <a-button type="danger" size="small" @click="del(i.content.id)">删除</a-button>
                </span>
            </a-list-item>
        </a-list>
    </div>
</template>

<script>

    export default {
        name: "Works",
        data(){
            return{
                list: [],
            }
        },
        created() {
            this.getData();
        },
        methods:{
            getData(){
                const t = this;
                axios.get('/atc/getAll').then(function (resp) {
                    t.list = resp.data;
                })
            },
            del(id){
                const t = this;
                axios.get('/admin/del/'+id).then(function (resp) {
                    t.getData();
                    t.$message.success('已删除');
                })
            }
        }
    }
</script>

<style scoped>

</style>